package cn.kgc.spring.entity;

/**
 * @author: mosin
 * @version: v1.0  2022/10/12
 * spring容器总bean的生命周期
 *
 *
 */
public class Teacher {

    private  Integer id;
    private  String name;


    public Teacher() {
        System.out.println("teacher的无参构造被调用");
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        System.out.println("teacher的set方法被调用");
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    //自定义初始换方法
    public void  init(){
        System.out.println("teacher的初始化方法被调用");
    }

    // 自定义销毁的方法
    public void  destroy(){
        System.out.println("teacher的销毁方法被调用");
    }



    @Override
    public String toString() {
        return "Teacher{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
